package com.arpa.ntocc.common.domain.dto;

import com.arpa.ntocc.common.common.validator.Save;
import com.arpa.ntocc.common.common.validator.Update;
import com.arpa.ntocc.common.common.validator.annotation.AccountPhoneExistConstraint;
import com.arpa.ntocc.common.common.validator.annotation.Pass;
import com.arpa.ntocc.common.common.validator.annotation.Phone;
import com.arpa.ntocc.common.domain.entity.BasicEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;

/**
 * 账号dto
 * @author liuxr
 * @date 2021/11/29 18:54
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="账号dto", description="账号dto")
public class UserDto extends BasicEntity {


    @ApiModelProperty(value = "用户类型")
    private String partyType;

    @ApiModelProperty(value = "手机号，用户账号")
    @NotBlank(message = "手机号不能为空", groups = {Save.class, Update.class})
    @Phone(message = "手机号格式不正确", groups = {Save.class})
    @AccountPhoneExistConstraint(message = "手机号已存在", groups = {Save.class})
    private String phone;

    @ApiModelProperty(value = "员工姓名")
    @NotBlank(message = "员工姓名不能为空", groups = {Save.class, Update.class})
    @Length(max = 20,min = 2,message = "员工姓名长度限制2~20个字符", groups = {Save.class, Update.class})
    private String name;

    @ApiModelProperty(value = "用户密码")
    @NotBlank(message = "密码不能为空", groups = {Save.class})
    @Pass
    private String upass;

    @ApiModelProperty(value = "状态 0正常，1禁用")
    private Integer status;

    @ApiModelProperty(value = "组织编号")
    private String groupCode;

    @ApiModelProperty(value = "授权仓库")
    @NotEmpty(message = "授权仓库不能为空", groups = {Save.class, Update.class})
    private String [] authorizationWarehouseCode;

    @ApiModelProperty(value = "授权货主")
    @NotEmpty(message = "授权货主不能为空", groups = {Save.class, Update.class})
    private String [] authorizationShipmentCode;

    @ApiModelProperty(value = "查询授权仓库code")
    private String  warehouseCode;

    @ApiModelProperty(value = "查询授权货主code")
    private String  shipmentCode;

    @ApiModelProperty(value = "查询授权仓库名称")
    private String  warehouseName;

    @ApiModelProperty(value = "查询授权货主名称")
    private String  shipmentName;


    @ApiModelProperty(value = "第几页")
    private Integer pageNum=1;

    @ApiModelProperty(value = "每页条数")
    private Integer pageSize=10;

    @ApiModelProperty(value = "排序字段")
    private String sortField;

    @ApiModelProperty(value = "排序方式")
    private String sortType;

    public interface Save {

    }

    public interface Update {

    }




}
